package com.lvpb.smart.framework.core.exception;

import com.lvpb.smart.framework.core.code.ResultCode;
import lombok.Data;

/**
 * @author lvpb
 * @version 1.0.0
 * @date 2024/8/8 23:30
 * @description ServiceException
 */
@Data
public class ServiceException extends RuntimeException{

    private Integer code;

    private String message;


    public ServiceException() {
    }

    public ServiceException(ResultCode resultCode) {
        super(resultCode.message());
        this.message = resultCode.message();
        this.code = resultCode.code();
    }


    public ServiceException(String message) {
        super(message);
        this.message = message;
    }

    public ServiceException(Integer code, String message) {
        super(message);
        this.code = code;
        this.message = message;
    }
}
